package demo.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import demo.config.BookComponent;
import demo.config.BookProperties;

/**
 * Spring Boot Hello案例
 *
 * Created by bysocket on 26/09/2017.
 */
@RestController
public class HelloBookController {

    @Autowired
    BookProperties bookProperties;


    @Autowired
    BookComponent bookComponent;

    @GetMapping("/hello")
    public String sayHello() {
        //http://localhost:8080/hello
        return "Hello， " + bookProperties.getWriter() + " is writing "
                + bookProperties.getName() + " " + bookProperties.getRand()+ " ！";
    }

    @GetMapping("/hello2")
    public String sayHello2() {
        return "Hello， " + bookComponent.getWriter() + " is writing "
                + bookComponent.getName() + " " + bookComponent.getRand()+ " ！";
    }
}
